home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pru_finale.cog < prev    next >
Text File  |  1999-11-15  |  16KB  |  567 lines

  1. # Jones 3D Cog Script
  2. #
  3. # PRU_finale.cog    Grab the idol and the floor drops away and another boulder starts to roll.
  4. # Triggers PRU_camerashake.cog.
  5. #
  6. # [GGJ] [RT]
  7. #
  8. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  9. #
  10. # ========================================================================================
  11.  
  12. symbols
  13.  
  14. message         startup                                 //startup
  15. message            entered                                    //triggers the doors
  16. message         pulse                                   //triggers falling blocks
  17. message         timer                                   //time between idol grab and ball roll
  18. message            arrived
  19. message            activated
  20. message            callback
  21.  
  22. cog                shake                                    //sends message to PRU_camerashake.cog
  23. cog                shake2                                    //sends message to PRU_camerashake2.cog
  24. cog                fallingDebris
  25.  
  26. sector            idolroom
  27.  
  28. sector            wobbleSec0
  29. sector            wobbleSec1
  30. sector            safeSect
  31.  
  32. sector            fallSector0
  33. sector            fallSector1
  34. sector            fallSector2
  35.  
  36.  
  37. sound            dialogue=pu04j01.wav                local
  38. sound            dialogue2=inxj011.wav                local         
  39. sound            floorfall=olv_fallfloor_c.wav        local
  40. sound               floorcrash=pru_boulder_crash_c.wav    local
  41. sound            rise=olv_quetzdoor_move_c.wav        local
  42. sound            stuck=pru_trapblock_stuck_c.wav        local
  43. sound            trigger=gen_stone_stop_c.wav         local    #or gen_stonebutt_push_c.wav lag_propbreak_c.wav nub_aethdoorarm_stop_c.wav
  44. sound            whistle=inxj006.wav                    local
  45. sound            wobble0=olv_presswitch_c.wav        local
  46. sound            sink=nub_2mstep_move_c.wav            local
  47. sound            musSafe=mus_gen_indyrelief.wav        local
  48. sound            great=inxj014.wav                    local
  49. sound            hmm=inxj269.wav                        local
  50. sound            trap=inxj041a.wav                    local
  51. sound            doorShutSnd=mus_gen_danger3.wav        local
  52. sound            idolGrabSnd=mus_gen_awesome1.wav    local
  53. sound            enterMus=mus_tem_tiki2int.wav        local
  54.  
  55. surface            safeSurf
  56.  
  57. thing           player                local           //Indy
  58. thing           floor0                                 //floor pieces that fall away
  59. thing           floor1
  60. thing           floor2
  61. thing           floor3
  62. thing           floor4
  63. thing           floor5
  64. thing           floor6
  65. thing           floor7
  66. thing           pedastal                                        //triggers doors
  67. thing           idol                                    //main treasure on level
  68. thing            invisibox                                #keeps Indy from jumping onto pedastal
  69.  
  70. thing            floortarget2
  71. thing            floortarget3
  72. thing            floortarget4
  73. thing            floortarget5
  74.  
  75. thing            door0                                    //entrance
  76. thing            door1                                   //exit
  77.  
  78. thing            camera0
  79. thing            camera1
  80. thing            camera2
  81. thing            camera3
  82. thing            actor                                    local
  83. thing            target0
  84. thing            target1
  85. thing            target2
  86. thing            camTarget0
  87. thing            camTarget1
  88. thing            floorTarget
  89. thing            safeActorGhost
  90. thing            invisiplate                                #prevents Indy's head from going through rising door
  91.  
  92. template        tplActor=indy_sh_actor                    local
  93.  
  94. keyframe        turnAroundR=in_rotate_right_nohead.key    local
  95. keyframe        turnAroundL=in_rotate_left_nohead.key    local
  96. keyframe        shaking=in_wobble.key                    local
  97. keyframe        putAway=0in_takeobj_1_1.key                local
  98.  
  99. flex    tempRotVel            local
  100.  
  101. vector        posOffset    local
  102. vector        angOffset    local
  103.  
  104. flex        posDelta=10.0    local
  105. flex        angDelta=180.0    local
  106.  
  107. int        chooseLine            local
  108. int        count = 0            local
  109. int        dialoguelength = 2
  110. int        curCam                local
  111. int        player                local
  112. int        tempCam                local
  113. int        once=0                local
  114. int        over=0                local
  115. int        safeOnce=0            local
  116. int        frame=2                local
  117. int        whistleScene=0        local
  118. int        grab=0                local
  119. int        sceneOnce=0            local
  120.  
  121. # Swapping stuff
  122. model    idolHand=hand_in_idol.3do    local
  123. int        callNum                        local
  124. int        swapRef                        local
  125. int        noPickup=1            local
  126.  
  127. end
  128.  
  129. # ========================================================================================
  130. code
  131.  
  132. startup:
  133. ClearThingFlags(pedastal, 0x40000000);
  134. player = GetLocalPlayerThing();
  135. SetThingLight(pedastal, '0.4 0.4 0.35', 1.0, 1.25);
  136. AttachThingToThing(invisiplate, door1);
  137. return;
  138.  
  139. # ========================================================================================
  140. entered:
  141. #Cutscene of Indy entering room and discovering the new idol.
  142. if ((GetSenderRef() == idolroom) && (once == 0))
  143. {
  144.     once = 1;
  145.     noPickup = 1;
  146.     curCam = GetCurrentCamera();
  147.     StartCutscene(1);
  148.     
  149.     #Stop the player from moving and put him in a standing position
  150.     MakeMeStop();
  151.     DeselectWeaponWait(player);
  152.     Sleep(0.01);
  153.     
  154.     #Create an actor at the player's location and swap them out
  155.     actor = CreateThing(tplActor, target0);
  156.     CaptureThing(actor);
  157.  
  158.     CopyPlayerHolsters(player, actor);
  159.     SetThingFlags(player, 0x80000);
  160.     ClearThingFlags(actor, 0x80000);
  161.     ResetThing(player);
  162.  
  163.     PlaySoundLocal(enterMus, 1, 0, 0x0, 0);
  164.  
  165.     #The actor walks over to the idol.
  166.     AISetLookThing(actor, idol);
  167.     AISetMoveSpeed(actor, 1.0);
  168.     AISetMoveThing(actor, target1, 0);
  169.     MoveToFrame(camTarget0, 1, 1.25);
  170.  
  171.     SetCameraPosInterp(2, 0);
  172.     SetCameraLookInterp(2, 0);
  173.     SetCameraFocus (2, camera0);
  174.     SetCameraSecondaryFocus(2, camTarget0);
  175.     SetCurrentCamera(2);
  176.     SetCameraFOV(70, 0, 0.0);
  177.     Sleep(0.01);
  178.     SetCameraFOV(25, 1, 2.7);
  179.     MoveToFrame(camera0, 1, 2.0);
  180.     AIWaitForStop(actor);
  181.     CopyOrientandPos(actor, player);
  182.     AISetLookPos(actor, vectorAdd(GetThingPos(idol), '0.0 0.0 -0.05'));
  183.     Sleep(0.5);
  184.             
  185.     #"Another Idol!  Well, Belloq won't get this one!"
  186.     PlayVoice(actor, dialogue, 1, 1);
  187.  
  188.     #Door closes behind Indy.  Camera turns left to watch.
  189.     PlaySoundLocal(doorShutSnd, 1.0, 0.0, 0x0, 0);
  190.     MoveToFrame(door0, 1, 2.0);
  191.     MoveToFrame(camTarget0, 2, 2.0);
  192.     SetCameraFOV(45, 1, 1.0);
  193.     Sleep(1.0);
  194.     
  195.     #Indy turns, noticing that he's trapped.  "Uh-oh!"
  196.     tempRotVel=GetThingMaxRotVel(actor);
  197.     AISetLookThing(actor, camera2);
  198.     AISetLookThing(actor, door0);
  199.     Sleep(0.75);
  200.     #PlayKey(actor, turnAroundR, 4, 0x12, 1);
  201.     PlayVoice(actor, dialogue2, 1, 1);
  202.     SetThingMaxRotVel(actor, 200.0);
  203.     Sleep(0.5);
  204.     #PlayKey(actor, turnAroundL, 4, 0x12, 0);
  205.     
  206.     SkipToFrame(camTarget0, 1, 1.75);
  207.     over=1;
  208.     AISetLookThing(actor, camera2);
  209.     Sleep(0.25);
  210.     AISetLookThing(actor, target2);
  211.     AIWaitForStop(actor);
  212.     
  213.     
  214.     #Move the player again so he's in the same spot as the actor, and swap them back
  215.     SetThingMaxRotVel(actor, tempRotVel);
  216.     CopyOrientandPos(actor, player);
  217.     SetThingFlags(actor, 0x80000);
  218.     #DestroyThing(actor);
  219.     ClearThingFlags(player, 0x80000);
  220.     ClearActorFlags(player, 0x200000);
  221.     DestroyThing(actor);
  222.     EndCutscene();
  223.     return;
  224. }
  225.  
  226. #Indy reaches safety beyond the falling floor blocks.
  227. if (((GetSenderRef() == safeSurf) || (GetSenderRef() == safeSect)) && (safeOnce == 0) && (sceneOnce == 0))
  228. {
  229.     sceneOnce=1;
  230.     SetPulse(0.0);
  231.     SendMessage(fallingDebris, user1);
  232.     whistleScene=1;
  233.     
  234.     TeleportThing(floor2, floortarget2);
  235.     TeleportThing(floor3, floortarget3);
  236.     TeleportThing(floor4, floortarget4);
  237.     TeleportThing(floor5, floortarget5);
  238.     
  239.     curcam=GetCurrentCamera();
  240.     SetCameraFocus (2, camera3);
  241.     SetCameraSecondaryFocus(2, camTarget1);
  242.     SetCurrentCamera(2);
  243.     MoveToFrame(camera3, 1, 1.0);
  244.     MoveToFrame(camTarget1, 1, 1.2);
  245.     
  246.     if (GetCurWeapon(player) != 2)
  247.     {
  248.         DeselectWeaponWait(player);        #put away anything but the whip.
  249.     }
  250.    
  251.     MakeMeStop();
  252.     
  253.     #Create an actor at the player's location and swap them out
  254.     StartCutscene(1);
  255.  
  256.     actor = CreateThing(tplActor, safeActorGhost);
  257.     CaptureThing(actor);
  258.     CopyPlayerHolsters(player, actor);
  259.     SetThingFlags(player, 0x80000);
  260.     ClearThingFlags(actor, 0x80000);
  261.     ResetThing(player);
  262.     AISetLookThing(actor, door0);
  263.     
  264.     SendMessage(shake, user0);
  265.     MoveToFrame(floor6, 1, 4.0);
  266.     PlaySoundThing(floorfall, floor6, 0.5, -1.0, -1.0, 0x880);
  267.     Sleep(1.5);
  268.     MoveToFrame(floor6, 2, 20.0);
  269.     Sleep(1.5);
  270.     MoveToFrame(floor7, 1, 4.0);
  271.     PlaySoundThing(stuck, floor7, 1, -1.0, -1.0, 0x880);
  272.     SetPOVShake('-0.001 0.001 -0.001', '0.01 -0.01 0.0', posDelta, angDelta);
  273.     Sleep(0.05);
  274.     SetPOVShake('0.001 -0.001 0.001', '-0.01 0.01 0.0', posDelta, angDelta);
  275.     Sleep(0.05);
  276.     SetPOVShake('-0.001 0.001 -0.001', '0.01 -0.01 0.0', posDelta, angDelta);
  277. }
  278.  
  279. #The loose floorblock will rock if Indy moves around on it.
  280. if ((getSenderRef() == wobbleSec0) && (GetSourceRef() == player) && (safeOnce == 1))
  281. {
  282.     if (frame == 1)
  283.     {
  284.         MoveToFrame(floor7, 2, 0.5);
  285.         frame=2;
  286.         PlaySoundThing(wobble0, floor7, 1, -1.0, -1.0, 0x880);
  287.         Sleep(0.05);
  288.         SetPOVShake('-0.001 0.001 -0.001', '0.01 -0.01 0.0', posDelta, angDelta);
  289.         Sleep(0.05);
  290.         SetPOVShake('0.001 -0.001 0.001', '-0.01 0.01 0.0', posDelta, angDelta);
  291.         Sleep(0.05);
  292.         SetPOVShake('-0.001 0.001 -0.001', '0.01 -0.01 0.0', posDelta, angDelta);
  293.     }
  294. }
  295.  
  296. if ((getSenderRef() == wobbleSec1) && (GetSourceRef() == player) && (safeOnce == 1))
  297. {
  298.     if (frame == 2)
  299.     {
  300.         MoveToFrame(floor7, 1, 0.5);
  301.         frame=1;
  302.         PlaySoundThing(wobble0, floor7, 1, -1.0, -1.0, 0x880);
  303.         Sleep(0.05);
  304.         SetPOVShake('0.001 -0.001 0.001', '-0.01 0.01 0.0', posDelta, angDelta);
  305.         Sleep(0.05);
  306.         SetPOVShake('-0.001 0.001 -0.001', '0.01 -0.01 0.0', posDelta, angDelta);
  307.         Sleep(0.05);
  308.         SetPOVShake('0.001 -0.001 0.001', '-0.01 0.01 0.0', posDelta, angDelta);
  309.     }
  310. }
  311. if ((GetSenderRef() == fallSector0) || (GetSenderRef() == fallSector1) || (GetSenderRef() == fallSector2))
  312. {
  313.     DetachThing(player);
  314.     return;
  315. }
  316.  
  317. return;
  318. # ========================================================================================
  319. activated:
  320.  
  321. if (grab == 1) return;
  322. Print("grab not equal to 1");
  323.  
  324. if (noPickup == 1) return;
  325.  
  326. if (GetSenderRef() == pedastal)
  327. {
  328.     Print("activated Idol");
  329.     grab = 1;
  330.     DeselectWeaponWait(player);
  331.     if ((GetMoveStatus(player) >= 3) && (GetMoveStatus(player) <= 5))
  332.     {
  333.          makemestop();
  334.     }
  335.     
  336.     DestroyThing(invisibox);
  337.  
  338.     #Stop the player from moving and put him in a standing position
  339.     MakeMeStop();
  340. //    Sleep(0.01);
  341.  
  342.     StartCutscene(1);
  343.     SetActorFlags(player, 0x200000);
  344.     curCam=GetCurrentCamera();
  345.     ResetCameraFOV(0, 0);
  346.     
  347.     #SetExtCamOffsetToThing(camera1);
  348.     PlaySoundLocal(IdolGrabSnd, 0.8, 0.0, 0x0, 0);
  349.  
  350.     #pos x is to the right, pos y is forward, pos z is up.
  351.     SetExtCamOffset('0.25 0.15 0.12');
  352.     SetExtCamLookOffSet('0.0 0.05 -0.01');
  353.     
  354.     #Create an actor at the player's location and swap them out.  Capture actor to get callback.
  355.     actor = CreateThing(tplActor, player);
  356.     CaptureThing(actor);
  357.     CopyPlayerHolsters(player, actor);
  358.     SetThingFlags(player, 0x80000);
  359.     ClearThingFlags(actor, 0x80000);
  360. //    ResetThing(player);
  361.  
  362.     PlayKey(actor, putAway, 4, 0x12, 1);
  363.  
  364. }
  365. return;
  366.  
  367. # ========================================================================================
  368. pulse:
  369. if (count < 7)
  370. {
  371.     SendMessage(shake, user0);
  372.     SendMessage(fallingDebris, user0);
  373.     MoveToFrame(floor0[count], 1, 4.0);
  374.     PlaySoundThing(floorfall, floor0[count], 0.5, -1.0, -1.0, 0x880);
  375.     if (count == 1)
  376.     {
  377.         MoveToFrame(pedastal, 2, 4.0);
  378.         PlaySoundThing(floorfall, pedastal, 0.5, -1.0, -1.0, 0x880);
  379.         SetTimer(1.5);
  380.     }
  381.     Sleep(1.5);
  382.  
  383.     if (count == 0)
  384.     {
  385.         # RT 10/9/99: Savegame fix -- moved from the callback section
  386.         MoveToFrame(door1, 1, 0.5);
  387.         PlaySoundThing(rise, door1, 0.7, -1, -1, 0x880);
  388.     }
  389.  
  390.     SendMessage(shake, user0);
  391.     MoveToFrame(floor0[count], 2, 15.0);
  392. }   
  393.  
  394. if (count == 7)
  395. {
  396.     MoveToFrame(floor7, 1, 4.0);
  397.     PlaySoundThing(stuck, floor7, 1, -1.0, -1.0, 0x880);
  398.     SetPulse(0.0);
  399.     SendMessage(fallingDebris, user1);
  400.     #return;                    
  401. }
  402.     
  403. count = count + 1;
  404.  
  405. return;
  406.  
  407. # ========================================================================================
  408. timer:
  409.         MoveToFrame(pedastal, 3, 15.0);
  410.         return;
  411.         
  412. # ========================================================================================
  413. arrived:
  414.     if ((GetSenderRef() == floor0[count]) && (GetCurFrame(floor0[count]) == 2))
  415.     {
  416.         PlaySoundThing(floorcrash, floor0[count], 1.0, 2.0, 20.0, 0x880);
  417.         SendMessage(fallingDebris, user1);
  418.     }
  419.     
  420.     #reset the camera at the end of the "another idol" cutscene.
  421.     if ((GetSenderRef() == camTarget0) && (over == 1))
  422.     {
  423.         Sleep(0.25);
  424.         SetCameraPosInterp(2, 0);
  425.         SetCameraLookInterp(2, 0);
  426.         tempCam = GetThingPos(camera2);
  427.         SetCameraPosition(curcam, tempCam);
  428.         SetCurrentCamera(curcam);
  429.         
  430.         Sleep(1.0);
  431.         noPickup = 0;
  432.     }
  433.  
  434. if ((GetSenderRef() == floor6) && (GetCurFrame(floor6) == 2) && (safeOnce == 1))
  435. {
  436.     AISetLookThing(actor, floor7);
  437.     #SetCameraSecondaryFocus(2, floor7);
  438. }
  439.  
  440. if ((GetSenderRef() == floor7) && (GetCurFrame(floor7) == 1) && (safeOnce == 0))
  441. {
  442.     safeonce=1;
  443.     if ((GetThingSector(player) == fallsector0) || (GetThingSector(player) == fallsector1) || (GetThingSector(player) == fallsector2)) return;
  444.     
  445.     if (whistleScene == 0)
  446.     {
  447.         SafeOnce=1;
  448.         SetPulse(0.0);
  449.         SendMessage(fallingDebris, user1);
  450.         whistleScene=1;
  451.         curcam=GetCurrentCamera();
  452.         SetCameraFocus (2, camera3);
  453.         SetCameraSecondaryFocus(2, camTarget1);
  454.         SetCurrentCamera(2);
  455.         MoveToFrame(camera3, 1, 1.0);
  456.         MoveToFrame(camTarget1, 1, 1.0);
  457.         PlaySoundLocal(musSafe, 1.0, 0.0, 0x0, 0);
  458.         
  459.         MakeMeStop();
  460.  
  461.         if (GetCurWeapon(player) != 2)
  462.         {
  463.             DeselectWeaponWait(player);        #put away anything but the whip.
  464.         }
  465.         
  466.         #Create an actor at the player's location and swap them out
  467.         actor = CreateThing(tplActor, player);
  468.         CaptureThing(actor);
  469.         CopyPlayerHolsters(player, actor);
  470.         SetThingFlags(player, 0x80000);
  471.         ClearThingFlags(actor, 0x80000);
  472.         AISetLookThing(actor, door0);
  473.     }
  474.     
  475.     Sleep(1.0);
  476.     
  477.     AISetMoveSpeed(actor, 1.0);
  478.     AISetMoveThing(actor, floorTarget, 1);
  479.     Sleep(0.25);
  480.     AISetLookThing(actor, floor0);
  481.     PlayVoice(actor, whistle, 1, 1);
  482.     
  483.     
  484.     Sleep(1.0);
  485.     CopyOrientandPos(actor, player);
  486.     SetThingFlags(actor, 0x80000);
  487.     #DestroyThing(actor);
  488.     ClearThingFlags(player, 0x80000);
  489.     ClearActorFlags(player, 0x200000);
  490.     EndCutscene();
  491.     SetCurrentCamera(curcam);
  492.     safeOnce=1;
  493. }
  494.  
  495. return;
  496.  
  497. # ========================================================================================
  498.  
  499. callback:
  500. Print("callback....  grrrr!  Indented!");    
  501.  
  502.     if (GetSenderRef() != actor)
  503.         return;
  504.  
  505. Print("GetsenderRef IS actor");
  506.     # 5/17/99 Randy: Here's where we take care of swapping the idol in and out of Indy's hand.
  507.     
  508.     callNum = GetParam(1);
  509. PRINtInt(callnum);
  510.  
  511.     if (callNum == 21)
  512.     {
  513.         # Swap the idol in
  514.         swapRef = SetThingMesh(actor, 15, idolHand, 0);
  515.         DestroyThing(idol);#
  516.         
  517.         ChangeInv(player, 36, 500.0);
  518.         SetInvAvailable(player, 36, 1);
  519.         JonesInvItemChanged(80);
  520.         
  521.     }
  522.     else if (callNum == 22)
  523.     {
  524.         # Now get rid of it
  525.         RestoreThingMesh(actor, swapRef);
  526.         
  527.         AISetLookPos(actor, vectorAdd(GetThingPos(pedastal), '0.0 0.0 0.01'));
  528.         
  529.         SetCameraFOV(70, 1, 2.0);
  530.         PlaySoundThing(trigger, pedastal, 1.0, -1.0, -1.0, 0x880);
  531.         MoveToFrame(pedastal, 1, 0.3);
  532.         PlaySoundThing(sink, pedastal, 1.0, -1.0, -1.0, 0x880);
  533.         chooseLine = RandBetween(1, 2);
  534.         Sleep(0.25);
  535.         if (chooseLine == 1)
  536.         {
  537.             PlayVoice(actor, great, 1, 0);
  538.         }
  539.         else
  540.         {
  541.             PlayVoice(actor, hmm, 1, 1);
  542.             Sleep(0.5);
  543.             PlayVoice(actor, trap, 1, 0);
  544.         }
  545.         
  546.         SetPulse(3.0);
  547.         
  548.         Sleep(2.25);
  549.     
  550.         #Move the player again so he's in the same spot as the actor, and swap them back
  551.         CopyOrientandPos(actor, player);
  552.         SetThingFlags(actor, 0x80000);
  553.         #DestroyThing(actor);
  554.         ClearThingFlags(player, 0x80000);
  555.         ClearActorFlags(player, 0x200000);
  556.         
  557.         #SetCurrentCamera(curCam);
  558.         RestoreExtCam();
  559.         ResetCameraFOV(0, 0);
  560.         EndCutscene();
  561.         
  562.         Sleep(3.0);
  563.     }
  564.     return;
  565.  
  566. end
  567.